﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using WTwitter.ViewModel.Utility;

namespace WTwitter.View {
	/// <summary>
	/// ViewModelを受け取って、そのViewModelに応じたWindowを表示するクラス
	/// </summary>
	class ViewFactory {
		//シングルトン
		private static ViewFactory _instance = new ViewFactory();
		public static ViewFactory Instance {
			get { return _instance; }
		}

		public void Initialize() {
			ViewConnector.Instance.RequestShowWindow += OnShowWindowRequested;
		}

		private void OnShowWindowRequested(object sender, RequestShowViewModelEventArgs e) {
			//汎用View(ウィンドウ)でViewModelを表示する
			var window = new GeneralView(e.ViewModel);
			window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
			window.Show();
		}
	}
}
